

var list = []

$(function(){

    // $('')

    $('#title').bind('keypress',function(event){
        
            var value = $('#title').val()

            list.push(value)

        if(event.keyCode == '13'){

            event.preventDefault()

            window.localStorage.setItem('value',JSON.stringify(list))
            
            // alert( $('#title').val())

                $('#todolist').append(`<li>
                <input type="checkbox" />
                <p onclick="edit(1)">${ value }</p>
                <a href="javascript:remove(1)">-</a>
                </li>
                `)
                
                $('#title').val('')

        }

    })

})


$(function(){


     list = JSON.parse(window.localStorage.getItem('value'))
    //  console.log(list)
     const a = list.length - 0 + 3
    // console.log(list)
    // console.log(123)
    if(list){
        
        for(var i = 0 ; i < list.length ; i++){
            
            $('#todolist').append(`<li>
                <input type="checkbox" />
                <p onclick="edit(1)">${ list[i] }</p>
                <a href="javascript:remove(1)">-</a>
                </li>
                `)
        }

        $('#todocount').html(a)
    }else{
        list = []
    }

    
})



$(function(){

    list = JSON.parse(window.localStorage.getItem('value'))

    const a = list.length - 0 + 3 

    $('#todolist > li').on('click','a' ,function(){

        a-1

        $(this).parent().remove()

       const opp = $(this).parent()[0]

        console.log(opp)
        // const inp = $('opp').find('input')
       $('#donelist').append(opp)
    })

    $('#todocount').html(a)

})

$(function(){

    list = JSON.parse(window.localStorage.getItem('value'))

    const a = list.length - 0 + 2 

    $('#donelist > li').on('click','a' ,function(){

        a-1

        $(this).parent().remove()

       $('#donelist').append(opp)
    })

    $('#todocount').html(a)

})

